package cn.woo5.test.detector.controller;

import cn.woo5.test.detector.utils.RegexUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/regex")
@RestController
public class RegexTestController {

    @RequestMapping(value = "/fetchGroup1", method = RequestMethod.POST)
    public String fetchGroup1(@RequestParam String src, @RequestParam String regex) {
        return RegexUtils.fetchGroup1(src, regex);
    }

    @RequestMapping(value = "/fetchGroup1List", method = RequestMethod.POST)
    public List<String> fetchGroup1List(@RequestParam String src, @RequestParam String regex) {
        return RegexUtils.fetchGroup1List(src, regex);
    }


}
